<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<div class="aui-block">
    <div class="aui-operation">
        <lv-group lvGutter="16px">
            <span>
                <lv-search [lvFocus]="true" [(ngModel)]="name" (lvSearch)="search($event)"
                    lvPlaceHolder="{{'search_resource_keyword_label'|i18n:['']}}" style="width:262px">
                </lv-search>
            </span>
            <lv-select [lvOptions]="appTypeOptions" [(ngModel)]="appType" lvMode="multiple"
                (ngModelChange)="changeAppType($event)" lvShowFilter lvShowCheckAll lvFilterKey="label"
                lvFilterMode="contains" style="width:212px"
                lvPlaceholder="{{'explore_please_select_resource_type_label' | i18n}}"></lv-select>
            <lv-select [lvOptions]="detectionTypeOptions" [(ngModel)]="detectType" lvMode="multiple"
                (ngModelChange)="changeDetectType($event)" lvShowFilter lvShowCheckAll lvFilterKey="label"
                lvFilterMode="contains" style="width:212px"
                lvPlaceholder="{{'explore_please_select_copy_status_label' | i18n}}"></lv-select>
        </lv-group>
        <lv-group>
            <button class="aui-button-icon" lv-button lvSize="auto" (click)="dataTable.fetchData()">
                <i lv-icon="lv-icon-refresh" [lvColorState]="true"></i>
            </button>
        </lv-group>
    </div>
    <div class="list-container">
        <lv-pro-table #dataTable [config]="tableConfig" [data]="tableData"></lv-pro-table>
    </div>
</div>

<ng-template #repicasTpl let-item>
    <span [ngClass]="{'special-col': item.total_copy_num}" id="outerClosable" lv-overflow
        (click)="getRepicasDetail(item,dataMap.Detection_Copy_Status.all.value,item.total_copy_num)">
        {{item.total_copy_num ? item.total_copy_num : '--'}}
    </span>
</ng-template>
<ng-template #infectedRepicasTpl let-item>
    <span [ngClass]="{'special-col': item.infected_copy_num}" id="outerClosable" lv-overflow
        (click)="getRepicasDetail(item,dataMap.Detection_Copy_Status.infected.value,item.infected_copy_num)">
      <i lv-icon="lv-icon-status-error" *ngIf="item.infected_copy_num>0"></i>
        {{item.infected_copy_num ? item.infected_copy_num : '--'}}
    </span>
</ng-template>
<ng-template #uninfectedRepicasTpl let-item>
    <span [ngClass]="{'special-col': item.uninfected_copy_num}" id="outerClosable" lv-overflow
        (click)="getRepicasDetail(item,dataMap.Detection_Copy_Status.uninfected.value,item.uninfected_copy_num)">
        {{item.uninfected_copy_num ? item.uninfected_copy_num : '--'}}
    </span>
</ng-template>
<ng-template #prepareRepicasTpl let-item>
    <span [ngClass]="{'special-col': item.prepare_copy_num}" id="outerClosable" lv-overflow
        (click)="getRepicasDetail(item,dataMap.Detection_Copy_Status.ready.value,item.prepare_copy_num)">
        {{item.prepare_copy_num ? item.prepare_copy_num : '--'}}
    </span>
</ng-template>
<ng-template #detectingRepicasTpl let-item>
    <span [ngClass]="{'special-col': item.detecting_copy_num}" id="outerClosable" lv-overflow
        (click)="getRepicasDetail(item,dataMap.Detection_Copy_Status.detecting.value,item.detecting_copy_num)">
        {{item.detecting_copy_num ? item.detecting_copy_num : '--'}}
    </span>
</ng-template>
<ng-template #uninspectedRepicasTpl let-item>
    <span [ngClass]="{'special-col': item.uninspected_copy_num}" id="outerClosable" lv-overflow
        (click)="getRepicasDetail(item,dataMap.Detection_Copy_Status.uninspected.value,item.uninspected_copy_num)">
        {{item.uninspected_copy_num ? item.uninspected_copy_num : '--'}}
    </span>
</ng-template>
<ng-template #abnormalRepicasTpl let-item>
    <span [ngClass]="{'special-col': item.abnormal_copy_num}" id="outerClosable" lv-overflow
        (click)="getRepicasDetail(item,dataMap.Detection_Copy_Status.exception.value,item.abnormal_copy_num)">
        {{item.abnormal_copy_num ? item.abnormal_copy_num : '--'}}
    </span>
</ng-template>
